package tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;


public class TrackTag extends TagSupport
{
    private String width = null;
    private String height = null;
    private String color = null;

    @Override
    public int doEndTag() throws JspException {
        Tag parent = this.getParent();
        if (parent == null || !(parent instanceof SliderTag))
            throw new JspException("TrackTag's parent must be of type SliderTag.");
        SliderTag sliderTag = (SliderTag)parent;
        sliderTag.setTrackTag(this);
        return super.doEndTag();
    }

    @Override
    public void release()
    {
        super.release();
        width = null;
        height = null;
        color = null;
    }

    public String getWidth() {
        return width;
    }

    public void setWidth(String width)
    {
        this.width = width;
    }

    public String getHeight() {
        return height;
    }

    public void setHeight(String height)
    {
        this.height = height;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
}
